package test;

import java.io.File;

public class CanRead
{

	/**
	 * @param args
	 */
	public static void main(String[] args)
	{

		File f = new File("C:/data/a/old/20110930_schedule.txt");
		long timeoutSecs=1000;
		long intervalCheckSecs=5;
		long waitedSecs = 0;
		while (!f.canWrite() && waitedSecs <= timeoutSecs)
		{
			System.out.println("Wait " + intervalCheckSecs + " of " + waitedSecs + " / " + timeoutSecs + " for file to appear: " + f);
			try 
			{
				Thread.sleep(intervalCheckSecs * 1000);
			} 
			catch (Exception e) 
			{
			}
			waitedSecs += intervalCheckSecs;			
		}
		System.out.println("file ready");
		
	}

}
